Skip to contentSkip to conversation

Change in openvpn[master]: iservice: check for NULL pointer

Openvpn-devel In review d12fk (Code Review) 2 participants 6 messages Nov 23, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1763880426000.Icd7c7b08e317aefd91a60bfc62e92cd8707b6fac@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1393?usp=email

to review the following change.

Change subject: iservice: check for NULL pointer
......................................................................

iservice: check for NULL pointer

Check if the list argument to ListContainsDomain() is NULL. Otherwise the call to wcsstr() will bail out.

Change-Id Icd7c7b08e317aefd91a60bfc62e92cd8707b6fac

---
M src/openvpnserv/interactive.c

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/93/1393/1

src/openvpnserv/interactive.c +1 -1
index ec80a30..006f748 100644
@@ -2106,7 +2106,7 @@
 ListContainsDomain(PCWSTR list, PCWSTR domain, size_t len)
 {
     PCWSTR match = list;
-    while (TRUE)
+    while (match)
     {
         match = wcsstr(match, domain);
         if (!match)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1393?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icd7c7b08e317aefd91a60bfc62e92cd8707b6fac
Gerrit-Change-Number: 1393
Gerrit-PatchSet: 1
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: d12fk, plaisthos.

cron2 has posted comments on this change by d12fk. ( http://gerrit.openvpn.net/c/openvpn/+/1393?usp=email )

Change subject: iservice: check for NULL pointer
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1393?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icd7c7b08e317aefd91a60bfc62e92cd8707b6fac
Gerrit-Change-Number: 1393
Gerrit-PatchSet: 1
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Comment-Date: Sun, 23 Nov 2025 12:00:16 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#3 lore raw

PATCH 1/1 iservice: check for NULL pointer

In reply to a message not in the archive

From: Heiko Hund <[email protected]...>

Check if the list argument to ListContainsDomain() is NULL. Otherwise the call to wcsstr() will bail out.

Change-Id Icd7c7b08e317aefd91a60bfc62e92cd8707b6fac

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1393
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1393
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpnserv/interactive.c +1 -1
index ec80a30..006f748 100644
@@ -2106,7 +2106,7 @@
 ListContainsDomain(PCWSTR list, PCWSTR domain, size_t len)
 {
     PCWSTR match = list;
-    while (TRUE)
+    while (match)
     {
         match = wcsstr(match, domain);
         if (!match)
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: iservice: check for NULL pointer

Trivial enough. Stared-at-code, and buildbot did the compile tests.

I don't think this can ever happen in our context - search_domains comes from a single call chain, and is initialized here

        PWSTR wide_search_domains;
        wide_search_domains = utf8to16(search_domains);
        if (!wide_search_domains)
        {
            return ERROR_OUTOFMEMORY;
        }  
        SetNrptExcludeRules(nrpt_key, ovpn_pid, wide_search_domains);
        free(wide_search_domains);

.. but this change does not hurt, and "if (NULL) return FALSE" matches the function description "is 'domain' in 'list'? FALSE = no" just fine.

Your patch has been applied to the master branch.

commit 2e2ac94e9cf3d0bdb28339594c8236fa98784967

Author: Heiko Hund
Date:   Sun Nov 23 13:00:23 2025 +0100
     iservice: check for NULL pointer

     Signed-off-by: Heiko Hund <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1393
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg34611.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by d12fk. ( http://gerrit.openvpn.net/c/openvpn/+/1393?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: iservice: check for NULL pointer
......................................................................

iservice: check for NULL pointer

Check if the list argument to ListContainsDomain() is NULL. Otherwise the call to wcsstr() will bail out.

Change-Id Icd7c7b08e317aefd91a60bfc62e92cd8707b6fac

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1393
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34611.html

---
M src/openvpnserv/interactive.c

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/93/1393/2

src/openvpnserv/interactive.c +1 -1
index 860375d..07ca7c9 100644
@@ -2106,7 +2106,7 @@
 ListContainsDomain(PCWSTR list, PCWSTR domain, size_t len)
 {
     PCWSTR match = list;
-    while (TRUE)
+    while (match)
     {
         match = wcsstr(match, domain);
         if (!match)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1393?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icd7c7b08e317aefd91a60bfc62e92cd8707b6fac
Gerrit-Change-Number: 1393
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1393?usp=email )

Change subject: iservice: check for NULL pointer
......................................................................

iservice: check for NULL pointer

Check if the list argument to ListContainsDomain() is NULL. Otherwise the call to wcsstr() will bail out.

Change-Id Icd7c7b08e317aefd91a60bfc62e92cd8707b6fac

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1393
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34611.html

---
M src/openvpnserv/interactive.c

1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpnserv/interactive.c +1 -1
index 860375d..07ca7c9 100644
@@ -2106,7 +2106,7 @@
 ListContainsDomain(PCWSTR list, PCWSTR domain, size_t len)
 {
     PCWSTR match = list;
-    while (TRUE)
+    while (match)
     {
         match = wcsstr(match, domain);
         if (!match)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1393?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Icd7c7b08e317aefd91a60bfc62e92cd8707b6fac
Gerrit-Change-Number: 1393
Gerrit-PatchSet: 2
Gerrit-Owner: d12fk <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>